/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.domain;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.ToString;
import me.zhengjie.base.BaseBusiness;
import me.zhengjie.domain.LocalStorage;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.List;

/**
* @website https://el-admin.vip
* @description /
* @author xiahongbo
* @date 2022-05-30
**/
@Entity
@Data
@Table(name="BIS_ADL_ZHSQ")
public class AdlZhsq extends BaseBusiness implements Serializable {

    @Id
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
    @GeneratedValue(generator = "hibernate-uuid")
    @Column(name = "BIS_ADL_ZHSQ_ID")
    @ApiModelProperty(value = "主键ID")
    private String bisAdlZhsqId;

    @JoinColumn(name = "BIS_ZHSQ_ID")
    @ManyToOne(fetch=FetchType.LAZY)
    @ApiModelProperty(value = "照护ID", hidden = true)
    @JSONField(serialize = false)
    @ToString.Exclude
    private Zhsq zhsq;

    @Column(name = "BIS_ADL_XM_ID")
    @ApiModelProperty(value = "ADL项目表ID")
    private String adlXmId;

    @Column(name = "BIS_ADL_XMXX_ID")
    @ApiModelProperty(value = "ADL项目选项ID")
    private String adlXmxxId;

    @Column(name = "BIS_ADL_XMXX_NAME")
    @ApiModelProperty(value = "选项名称")
    private String adlXmxxName;

    @Column(name = "BIS_ADL_XMXX_FS")
    @ApiModelProperty(value = "选项分数")
    private String adlXmxxFs;

    @Column(name = "BIS_USER_ID")
    @ApiModelProperty(value = "用户ID")
    private Long bisUserId;

    @Column(name = "BIS_ZFBS")
    @ApiModelProperty(value = "作废标识")
    private String bisZfbs;


    @OneToMany(cascade=CascadeType.DETACH)//级联保存、更新、删除、刷新;延迟加载
    @JoinColumn(name="ywid")//在book表增加一个外键列来实现一对多的单向关联
    private List<LocalStorage> fjs;

    public void copy(AdlZhsq source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}